ΓÇóYou've heard of ShareWare and FreeWare! I now introduce TradeWare!!!
This script is TradeWare. If you find it useful, send me an 800K floppy packed with ShareWare and FreeWare goodies; I am especially interested in HyperCard development tools and utilities (such as XCMD/XFCNs, etc.ΓÇöI already have the Developer Stack, Thank You), and system tools and utilities (INITs and CDEVs, etc). In return, I will send your disk back to you with ShareWare and FreeWare goodies from my own collection. No sound stacks, pleaseΓÇöthey're too obnoxious, and wasteful of disk space and memory.
Please send neat (and/or useful) stuff to:
Dean H. Wette
921 DeMun Avenue 2N
Clayton, MO 63105
314-863-4944
ΓÇóNow...finally...about ChangeObjectLayer...
While developing a stack containing numerous modal popup dialogs, fields, and buttons, I found myself constantly going to the "Objects" menu for the "Send Farther" and "Bring Closer" commands in order to move objects (buttons and fields) through different card and background layers. In some cases I wanted to obscure other objects, and in other cases I wanted to prevent objects from being obscured. Well, anyway, when you have 20 or more each of background and card buttons and fields, this menu selection (or its command key equivalent) business to change object layers can become quite tedious and boring.
Therefore, I developed "ChangeObjectLayer" to automate and speed-up the process of moving objects' through different layers. "ChangeObjectLayer" works with both card and background buttons and fields. Try it out! On this card are six each of card and background buttons and fields. See the effect of changing a card/background button/field from 6 to 1 and vice versa.
ΓÇóTo install ChangeObjectLayer functions
1) Copy the handler "setLayer" and the function "theLayer" plus the two utility handlers "setLocksTrue" and "setLocksFalse."
2) Paste everything into a card, background, or stack script. The best place for the "ChangeObjectLayer" scripts and the "setLocks" scripts is in the stack script of your Home stack, thus making the script available in all stacks.
ΓÇóTo invoke "ChangeObjectLayer" do the following:
1) Open the script editing window of the object (button or field) you want to change.
2a) If the object contains a script then add "setLayer" (with-out the quotes) as the second line of the objects scriptΓÇöthe line following "on mouseUp." The part of the script following "setLayer" will be disabled until you remove the call to "setLayer."
2b) If the object does not already have a script then type the following script in the script editing window:
on mouseUp
setLayer
end mouseUp
3) Click "OK" to close the editing window and then click on the object (make sure the browse tool is selected). Note: if the object is a field, then the lockText property must be set to true (i.e. lock the field) for "ChangeObjectLayer" to work.
4) You will be prompted to specify the number to which the object will be set. The prompt will indicate the valid range (e.g. "1-6" - you can't set a card button to 'card button 7' if there are only 6 card buttons). Enter a valid number, click "OK", and wait. "ChangeObjectLayer" will beep three times when it finished with its task.
5) Remove the "setLayer" line from the object script to reenable any original object script. If the "setLayer" call is the second line of the object's script, it will be removed for you.
[Hey Bill, can we fix the orphan quotes and parentheses?!?!]
ΓÇóNotes:
The "setLayer" handler concludes with an "exit to HyperCard" command so if you call it from an existing handler in a button or field, any script folowing the call will not execute until you remove the "setLayer" line of your object script.
Sometimes, when an object is set to its highest or lowest number it may still obscureΓÇöor be obscuredΓÇöby an object of its unlike type (field/button or vice versa). To remedy this, you may need to invoke "Send Farther" or "Bring Closer" additional times (i.e. use "Bring Closer" when an object is at its highest number already, or "Send Farther" when it is at its lowest number). This can be accomplished with "ChangeObjectLayer". [Those damn orphan quotes again!] If you hold down the optionkey while invoking the "setLayer" handler from an object, you can enter an invalid object number (such as 0 or 1,000,000). This will cause "ChangeObjectLayer" to invoke the "Send Farther" or "Bring Closer" menu commands forever. Press Command-. (period) to stop the repeated execution, and press Command-Tab to select the browse tool. The "setLayer" handler can be invoked once again in similar manner if necessary.
ΓÇóWell, that's about it for "ChangeObjectLayer" 1.0. I wrote and tested it on Friday, July, 29, 1988. If you find any bugs or have suggestions for improvements please let me know (no collect calls please). Happy setLayering!
--ChangeObjectLayer 1.0
--©1988 by Dean H Wette
--921 DeMun Avenue 2N
--Clayton, MO 63105
--314-863-4944
--Please include the above credits with the script.